package test00.lx05.t05;

import java.util.function.Function;

/**
 * @author ZQX
 * @date 2025-04-07
 */
public class MainTest {
    public static void main(String[] args) {
        String str = "张三,18";

        // R apply(T t);
        // 基于 Lambda 表达式，实现函数式接口
        Function<String, Student> fun = (s) -> {
            String[] arr = s.split(",");

            String name = arr[0];
            int age = Integer.parseInt(arr[1]) + 1 ;

            return new Student(name, age);
        };


        Student stu = fun.apply(str);
        System.out.println(stu);

    }
}
